package com.tianheng.modbus.entity;


import lombok.Data;
import lombok.ToString;
import org.hibernate.annotations.NotFound;
import org.hibernate.annotations.NotFoundAction;


import javax.persistence.*;

@Data
@Entity
public class ModbusDevice {

    @Id
    private Long id;

    @Column(name = "modbus_domain_id")
    private Long modbusDomainId;

    @Column(name = "modbus_group_id")
    private Long modbusGroupId;

    private String name;

    private String code;

    private String ip;

    private Long port;

    @Column(name = "slave_id")
    private Long slaveId;

    @Column(name = "refresh_interval")
    private Long refreshInterval;

    @Column(name = "is_enabled")
    private Boolean isEnabled;

    @ToString.Exclude
    @OneToOne
    @NotFound(action= NotFoundAction.IGNORE)
    @JoinColumn(name="modbus_device_template_id", referencedColumnName = "id")
    private ModbusDeviceTemplate modbusDeviceTemplate;


}